package com.tubi.ArrayList;

import com.tubi.domain.Student;

import java.util.ArrayList;

public class ArrayList学生类集合 {

    public static void main(String[] args) {
        //创建集合对象
        ArrayList<Student> st = new ArrayList();
        //创建学生对象
        Student s = new Student("荣磊",12);
        Student s1 = new Student("www",12);
        Student s2 = new Student("ww",12);
        //添加集合
        st.add(s);
        st.add(s1);
        st.add(s2);

        //遍历集合
        for (int i = 0; i < st.size(); i++) {
            Student student = st.get(i);
            System.out.println(student.getName()+"++++"+student.getAge());
        }
    }
}
